package com.mbyte.easy.common.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mbyte.easy.admin.entity.Relation;
import com.mbyte.easy.admin.service.IRelationService;
import com.mbyte.easy.common.constant.roleCommonEntity;
import com.mbyte.easy.common.web.AjaxResult;
import com.mbyte.easy.security.service.IRoleService;
import com.mbyte.easy.security.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

/**
 * @ClassName roleListController
 * @Description:  角色的上下级关系
 * @Author: 白章荣
 * @Date : 2019/12/17/17:57
*/

public class roleListController  {
    @Autowired
    private IRelationService relationService;
    @Autowired
    private IUserService userService;
    @Autowired
    private IRoleService roleService;

    /**
     * 稿件终审人的直系下属
     * @return
     */

   public AjaxResult finalReviewer(){
       //板块负责人
       QueryWrapper<Relation>relationQueryWrapper=new QueryWrapper<>();
       relationQueryWrapper.eq("role_id",roleCommonEntity.BLOCK_LEADER);
       List<Relation> relationList = relationService.list(relationQueryWrapper);
       List<String>blocakLeaderList=new ArrayList<>();
       for(Relation relation :relationList){
           //根据自己的id去user表里查出自己的名字
           blocakLeaderList.add(userService.selectByPrimaryKey(relation.getUserId()).getUsername());
       }
       return null;
   }



}
